package com.ruoyi.actest.api.factory;

import com.ruoyi.actest.api.RemoteShopService;
import com.ruoyi.common.core.web.domain.AjaxResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @ClassName RemoteShopFallbackFactory
 * @Description TODO
 * @Author xgj
 * @Date 2025年01月03日 下午3:18
 * @Version 1.0
 */
@Component
public class RemoteShopFallbackFactory implements FallbackFactory<RemoteShopService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteShopFallbackFactory.class);

    @Override
    public RemoteShopService create(Throwable throwable) {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteShopService() {

            @Override
            public AjaxResult getInfo(Long id, String source) {
                return AjaxResult.error("获取信息失败！");
            }

        };
    }
}
